Etienne TASSE adds ability to read Vito Navigator .SMT tracks.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 20 Jun 2005 14:58:38 +0000 (14:58 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 20 Jun 2005 14:58:38 +0000 (14:58 +0000)
gpsbabel/Makefile
gpsbabel/README
gpsbabel/msvc/GPSBabel.dsp
gpsbabel/testo
gpsbabel/vecs.c
gpsbabel/vitosmt.c [new file with mode: 0644]

index 733986566c25e588ed7b7abb0502f04212609381..f2a2847cd16a209f3f5073f2649c483926cd4cdb 100644 (file)
@@ -28,7 +28,7 @@ FMTS=magproto.o gpx.o geo.o mapsend.o mapsource.o garmin_tables.o \
        ozi.o nmea.o text.o html.o palmdoc.o netstumbler.o hsa_ndv.o \
        igc.o brauniger_iq.o shape.o hiketech.o glogbook.o coastexp.o \
        vcf.o overlay.o kml.o google.o lowranceusr.o an1.o tomtom.o \
-       tef_xml.o maggeo.o pathaway.o
+       tef_xml.o maggeo.o pathaway.o vitosmt.o
 
 FILTERS=position.o duplicate.o arcdist.o polygon.o smplrout.o reverse_route.o sort.o stackfilter.o
 
@@ -91,8 +91,8 @@ dep:
        (echo -n "internal_styles.c: mkstyle.sh " ; echo style/*.style ; /bin/echo -e '\t./mkstyle.sh > internal_styles.c || (rm -f internal_styles.c ; exit 1)' ) >> /tmp/dep
        echo Edit Makefile and bring in /tmp/dep
 
-VERSIONU=1_2_6-beta06082005
-VERSIOND=1.2.6_beta06082005
+VERSIONU=1_2_6-beta06162005b-isaac
+VERSIOND=1.2.6_beta06162005b-isaac
 # VERSIONU=1_2_5
 # VERSIOND=1.2.5
 
index 164cb44fa89c810892e69bcadb0de32a1d6aae44..c2ea75c7d4e6b2d62749dff7d32b796702921aba 100644 (file)
@@ -839,6 +839,13 @@ THE FORMATS
         the icon.  It should be 22x22 and 16 colors, and have the same name
         (not including the extension) as the .ov2 file.
 
+    VitoSMT
+
+       Vito Navigator II is a Pocket PC GPS application.  This format reads
+       a Vito Navigator II .SMT track file in waypoint mode.  It is still 
+       a work in progress.
+
+
 DATA FILTERS
 
        GPSBabel supports data filtering.  Data filters are invoked from
index 45f765deebd525b1833aa708060aaabd246f3266..74d347e222d800ef3be41d690388abfb701633e9 100644 (file)
@@ -315,6 +315,10 @@ SOURCE=..\cetus.c
 # End Source File
 # Begin Source File
 
+SOURCE=..\vitosmt.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\coastexp.c
 # End Source File
 # Begin Source File
index 7b931e87b0535f90db6946754eb6b6b0088bdb31..1aca1f04a89df31ce2e6d76e9043c3aa7b8b228f 100755 (executable)
@@ -707,4 +707,11 @@ rm -f ${TMPDIR}/pathaway*
 ${PNAME} -t -i pathaway -f reference/track/pathaway.pdb -o gpx -F ${TMPDIR}/pathaway.gpx
 compare ${TMPDIR}/pathaway.gpx reference/track/pathaway.gpx
 
+#
+# Vito Navigator II .smt tests
+#
+rm -f ${TMPDIR}/vitosmt*
+${PNAME} -i vitosmt -f reference/vitosmt.smt -o gpx -F ${TMPDIR}/vitosmt.gpx
+compare ${TMPDIR}/vitosmt.gpx reference/vitosmt.gpx
+
 exit 0
index f524990c92a57f2d30275a7635d7b1fac4486980..388cd2d1ff3b7a287c0de5b3534e312a21534f18 100644 (file)
@@ -82,6 +82,7 @@ extern ff_vecs_t an1_vecs;
 extern ff_vecs_t tomtom_vecs;
 extern ff_vecs_t tef_xml_vecs;
 extern ff_vecs_t ppdb_vecs;
+extern ff_vecs_t vitosmt_vecs;
 
 static
 vecs_t vec_list[] = {
@@ -398,6 +399,12 @@ vecs_t vec_list[] = {
                "PathAway Palm Database",
                "pdb"
        },
+       {
+               &vitosmt_vecs,
+               "vitosmt",
+               "Vito Navigator II tracks",
+               "smt"
+       },      
        {
                NULL,
                NULL,
@@ -588,7 +595,7 @@ alpha (const void *a, const void *b)
        const vecs_t *const *ap = a;
        const vecs_t *const *bp = b;
        
-       return strcasecmp((*ap)->desc , (*bp)->desc);
+       return case_ignore_strcmp((*ap)->desc , (*bp)->desc);
 }
 
 /*
diff --git a/gpsbabel/vitosmt.c b/gpsbabel/vitosmt.c
new file mode 100644 (file)
index 0000000..c6af5c5
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+    Read Vito Navigator .SMT tracks
+    Copyright (C) 2005 Etienne TASSE
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+
+#define MYNAME "vitosmt"
+#include "defs.h"
+
+FILE *infile;
+
+static unsigned long
+ReadLong(FILE * f)
+{
+       gbuint32 result = 0;
+
+       fread(&result, sizeof (result), 1, f);
+       return le_read32(&result);
+}
+
+static double
+ReadDouble(FILE * f)
+{
+       /* unsigned char result[8] = "\0\0\0\0\0\0\0\0"; */
+       double result=0;
+
+       fread(&result, sizeof (result), 1, f);
+       return result;
+}
+
+
+static unsigned char *
+ReadRecord(FILE * f,
+          unsigned long size)
+{
+       unsigned char *result = (unsigned char *) xmalloc(size);
+
+       fread(result, size, 1, f);
+       return result;
+}
+
+static void
+Skip(FILE * f,
+     unsigned long distance)
+{
+       fseek(f, distance, SEEK_CUR);
+}
+
+static void
+rd_init(const char *fname)
+{
+       infile = xfopen(fname, "rb", MYNAME);
+}
+
+static void
+rd_deinit(void)
+{
+       fclose(infile);
+}
+
+static void
+vitosmt_read(void)
+{
+       unsigned short version                  =0;
+       unsigned long count                             =0;
+       const unsigned long recsize             =64;
+       unsigned short stringlen                =0;
+       static int serial                               =0;
+
+/*     route_head              *track_head             =0; */
+       waypoint                *wpt_tmp                =0;
+       double                  latrad                  =0;
+       double                  lonrad                  =0;
+       double                  elev                    =0;
+       unsigned char*  timestamp               =0;
+       struct tm               tmStruct                ={0,0,0,0,0,0,0,0,0};
+
+       /* 
+        * 24 bytes header 
+        */
+       version = ReadLong(infile);     /* 2    */
+       ReadLong(infile);                       /* 1000 */
+       count = ReadLong(infile);       /* 600  */
+       ReadLong(infile);                       /* 0    */
+       ReadLong(infile);                       /* 599  */
+       ReadLong(infile);                       /* 600  */
+
+/*     track_head = route_head_alloc(); */
+/*     route_add_head(track_head); */
+       
+
+       while (count) {
+               /*
+                *      64 bytes of data        
+                */
+               latrad          =ReadDouble(infile);    /* WGS84 latitude in radians */
+               lonrad          =ReadDouble(infile);    /* WGS84 longitude in radians */
+               elev            =ReadDouble(infile);    /* elevation in meters */
+               timestamp       =ReadRecord(infile,8);  /* local time */
+               Skip(infile,32);                /* remainder, unknown fmt */
+
+               wpt_tmp = waypt_new();
+               
+               wpt_tmp->latitude       =(latrad * 180) / M_PI;
+               wpt_tmp->longitude      =(lonrad * 180) / M_PI;
+               wpt_tmp->altitude       =elev;
+
+               tmStruct.tm_year        =timestamp[0]+100;
+               tmStruct.tm_mon         =timestamp[1]-1;
+               tmStruct.tm_mday        =timestamp[2];
+               tmStruct.tm_hour        =timestamp[3];
+               tmStruct.tm_min         =timestamp[4];
+               tmStruct.tm_sec         =timestamp[5];
+               tmStruct.tm_isdst       =-1;
+
+               wpt_tmp->creation_time = mktime(&tmStruct); /* + get_tz_offset(); */
+
+               wpt_tmp->shortname = (char *) xmalloc(10);
+               snprintf(wpt_tmp->shortname, 10, "SMT%04d",++serial);
+               wpt_tmp->wpt_flags.shortname_is_synthetic = 1;
+               
+               waypt_add(wpt_tmp);
+
+               xfree(timestamp);
+
+
+               count--;
+       }
+}
+
+static void
+wr_init(const char *fname)
+{
+       fatal(MYNAME ":Not enough information is known about this format to write it.\n");
+}
+
+ff_vecs_t vitosmt_vecs = {
+       ff_type_file,
+       { ff_cap_read, ff_cap_read, ff_cap_none},
+       rd_init,
+       wr_init,
+       rd_deinit,
+       NULL,
+       vitosmt_read,
+       NULL,
+       NULL, 
+       NULL
+};